home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 24
/
024.d81
/
inside the 1571
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
5KB
|
133 lines
190 t$(0)="del":t$(1)="seq":t$(2)="prg":t$(3)="usr":t$(4)="rel":close15
200 dm$(0)="single": dm$(1)="double"
210 dim a$(256): nl$=chr$(0): q$=chr$(34): sp$=chr$(160)
220 printchr$(142)"[147] [176][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][174]"
230 print " [194] disk utilities [194]"
240 print " [173][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][189]"
250 close 2: close 4: close 15: open 15,8,15
260 print#15,"u0>m9": input#15,en
270 if en<>31 then dt=0: dm=0: print spc(11);"disk drive = 1541": goto 300
280 dt=1: print#15,"u0>h0": input#15,en: dm=0: if en=31 then dm=1
290 print"disk drive = 1571, in ";dm$(dm);" sided mode"
300 print"[195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195]"
310 print" 1 = normal directory (side 1/2)"
320 print" 2 = full directory (deleted files)"
330 print" 3 = lock/unlock file"
340 print" 4 = change disk name"
350 print" 5 = issue disk command"
360 ml=5: am=(dm+1) and 1: if dt=0 then print: goto 390
370 print" 6 = switch drive to ";dm$(am);" sided mode": ml=6
380 print spc(22);"[163][163][163][163][163][163]"
390 print" q = quit"
400 print"[195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195]"
410 print"desired function: ";
420 get c$: if c$="" then 420
430 if c$="q" then print c$: goto 1500
440 f=val(c$): if f<1 or f>ml then 420
450 print c$: on f goto 550,550,520,550,470
460 print#15,"u0>m"+chr$(48+am): goto 220
470 print"desired disk command (in quotes):"
480 gosub 1490: if x$=sp$ then 220
490 print#15,x$: input#15,en,em$,et,es
500 print"error#:";en;" trk/sec:";et;"/";es
510 print em$: gosub 1450: goto 220
520 print "filename to be locked/unlocked:"
530 gosub 1490: if x$=sp$ then 220
540 fl$=left$(x$+"[160][160][160][160][160][160][160][160][160][160][160][160][160][160][160][160]",16): rem (16 shifted spaces)
550 print#15,"i0": input#15,en,em$,et,es: if en=0 then 580
560 if en<>21 and t<>18 and s<>0 then gosub 1440: goto 220
570 print"please insert disk & reselect function!": goto 1130
580 open2,8,2,"#0": gosub 1430: if en>0 then 220
590 print "ok, reading block avail map (bam)..."
600 t=18: s=0: gosub 1300: if en>0 then 220
610 h1$="disk "+q$: for n=144 to 159: h1$=h1$+a$(n): next n
620 h1$=h1$+q$+" id="+a$(162)+a$(163)+" fmt="+a$(165)+a$(166)
630 c=0: for n=4 to 140 step 4: c=c+asc(a$(n)): next n
640 if asc(a$(3))>0 then for n=221 to 255: c=c+asc(a$(n)): next n
650 h2$=right$(" "+str$(c),5)+" blocks free ("
660 h2$=h2$+dm$(asc(a$(3))/128)+" sided)"
670 pd=3: if f>2 then 720
680 print"printed output wanted (y/n): ";
690 get c$: if c$="n" then 720
700 if c$<>"y" then 690
710 pd=4: gosub 1220
720 open 4,pd
730 gosub 1260: if f<>4 then 830
740 print"enter new disk name for this disk:"
750 gosub 1490: if x$=sp$ then 1200
760 iflen(x$)>16thenprint"input string is longer than 16 chars!":goto740
770 x$=left$(x$+"[160][160][160][160][160][160][160][160][160][160][160][160][160][160][160][160]",16): rem (16 shifted spaces)
780 print#15,"b-p:2,144": gosub 1430: if en>0 then 220
790 print#2,x$;
800 print#15,"u2:2,0,";t;s: gosub 1430: if en>0 then 220
810 print#15,"i0"
820 print" disk bam updated with new disk name": goto 1130
830 if f=3 then print"searching for file: ";q$;fl$;q$: print
840 t=asc(a$(0)): s=asc(a$(1)): if t>0 then 870
850 if f=3 then print spc(12);"file not found"
860 goto 1130
870 gosub 1300: if en>0 then 220
880 for n=2 to 226 step 32: ft=asc(a$(n)) and 7
890 if ft=0 and f<>2 then 1190
900 c=asc(a$(n+28))+(asc(a$(n+29))*256)
910 if c=0 then h=0:for x=3 to 18:h=h+asc(a$(n+x)):next x:if h=0 then 790
920 n$="": for y=3 to 18: n$=n$+a$(n+y): next y
930 if f=3 then if fl$<>n$ then 1190
940 print#4,right$(" "+str$(c),5);" ";q$;n$;
950 print#4,q$;" ";t$(ft);" ";: if ft=0 then 1010
960 lk=0: if (asc(a$(n)) and 192)=192 then print#4,"(l)";: lk=1: goto 990
970 op=0: if (asc(a$(n)) and 128)=0 then print#4,"(o)";: op=1: goto 1010
980 print#4," ";
990 print#4," ";
1000 gosub 1330: if en>0 then 220
1010 print#4: if f<>3 then 1140
1020 if op=1 then print"file is not properly closed!": goto 1130
1030 print"ok to ";: if lk=1 then print"un";
1040 print"lock file (y/n): ";
1050 get c$: if c$="n" then 1210
1060 if c$<>"y" then 1050
1070 print c$
1080 h=(asc(a$(n)) and 191): if lk=0 then h=h+64
1090 print#15,"b-p:2,";n: gosub 1430: if en>0 then 220
1100 print#2,chr$(h);
1110 print#15,"u2:2,0,";t;s: gosub 1430: if en>0 then 220
1120 print"directory updated with new lock status"
1130 print: gosub 1450: goto 220
1140 l=l-1: if l=0 then gosub 1240: if c$="q" then 220
1150 if pd=3 then 1190
1160 get c$: if c$="" then 1190
1170 print spc(10);"output suspended": gosub 1460: if c$="q" then 220
1180 gosub 1220
1190 next n: goto 840
1200 print spc(8);"no change to disk name": goto 1130
1210 print c$: print spc(8);"no change to directory": goto 1130
1220 print"[147]printing disk directory"
1230 print"press any key to pause output": return
1240 if pd=4 then for x=1 to 10: print#4: next x: c$="": goto 1260
1250 gosub 1460: if c$="q" then return
1260 l=50: if pd=3 then l=16: print"[147]";
1270 print#4,h1$: print#4: print#4,h2$
1280 print#4: print#4,"---------------------------------------"
1290 print#4: return
1300 print#15,"u1:2,0,";t;s: gosub 1430: if en>0 then return
1310 for n=0 to 255: get#2,a$(n): if a$(n)="" then a$(n)=nl$
1320 next n: return
1330 en=0: if f=3 then return
1340 t=asc(a$(n+1)): s=asc(a$(n+2)): gosub 1370
1350 if (en+h)>0 or ft<>4 then return
1360 t=asc(a$(n+19)): s=asc(a$(n+20))
1370 h=0: if t>35 then h=1: print#4,"(2)";: return
1380 print#15,"u1:2,0,";t;s: gosub 1430: if en>0 then return
1390 get#2,c$,d$: if c$="" then c$=nl$
1400 if d$="" then d$=nl$
1410 t=asc(c$): s=asc(d$): if t>0 then 1370
1420 return
1430 input#15,en,em$,et,es: if en=0 then return
1440 print: print"disk error:[146]";en;" trk/sec:[146]";et;"/";es: print em$
1450 print" press any key to continue ": goto 1470
1460 print"press any key to continue, 'q' to quit[146]";
1470 get c$: if c$="" then 1470
1480 return
1490 print"";sp$;"[157][157][157]";: input x$: return
1500 close 2: close 4: close 15:load"hello connect",8